<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><div id="myscoll"></div><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>LVGL | Certainly</title><meta name="keywords" content="学习,笔记"><meta name="author" content="Certainly"><meta name="copyright" content="Certainly"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="LVGL">
<meta property="og:type" content="article">
<meta property="og:title" content="LVGL">
<meta property="og:url" content="https://certainly.gitee.io/posts/58e5bee2.html">
<meta property="og:site_name" content="Certainly">
<meta property="og:description" content="LVGL">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://s1.vika.cn/space/2022/09/17/6627f0a573bc42fe9ce7f9cc51fefd99">
<meta property="article:published_time" content="2023-09-30T14:00:40.000Z">
<meta property="article:modified_time" content="2023-09-30T14:00:40.000Z">
<meta property="article:author" content="Certainly">
<meta property="article:tag" content="学习">
<meta property="article:tag" content="笔记">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://s1.vika.cn/space/2022/09/17/6627f0a573bc42fe9ce7f9cc51fefd99"><link rel="shortcut icon" href="/"><link rel="canonical" href="https://certainly.gitee.io/posts/58e5bee2"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":true,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"It has been","messageNext":"days since the last update, the content of the article may be outdated."},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":230},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: true
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdnjs.cloudflare.com/ajax/libs/flickr-justified-gallery/2.1.2/fjGallery.min.js',
      css: 'https://cdnjs.cloudflare.com/ajax/libs/flickr-justified-gallery/2.1.2/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'LVGL',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-09-30 17:07:11'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="https://cdn1.tianli0.top/npm/element-ui@2.15.6/packages/theme-chalk/lib/index.css"><style id="themeColor"></style><style id="rightSide"></style><style id="transPercent"></style><style id="blurNum"></style><style id="settingStyle"></style><span id="fps"></span><style id="defineBg"></style><style id="menu_shadow"></style><svg aria-hidden="true" style="position:absolute; overflow:hidden; width:0; height:0"><symbol id="icon-sun" viewBox="0 0 1024 1024"><path d="M960 512l-128 128v192h-192l-128 128-128-128H192v-192l-128-128 128-128V192h192l128-128 128 128h192v192z" fill="#FFD878" p-id="8420"></path><path d="M736 512a224 224 0 1 0-448 0 224 224 0 1 0 448 0z" fill="#FFE4A9" p-id="8421"></path><path d="M512 109.248L626.752 224H800v173.248L914.752 512 800 626.752V800h-173.248L512 914.752 397.248 800H224v-173.248L109.248 512 224 397.248V224h173.248L512 109.248M512 64l-128 128H192v192l-128 128 128 128v192h192l128 128 128-128h192v-192l128-128-128-128V192h-192l-128-128z" fill="#4D5152" p-id="8422"></path><path d="M512 320c105.888 0 192 86.112 192 192s-86.112 192-192 192-192-86.112-192-192 86.112-192 192-192m0-32a224 224 0 1 0 0 448 224 224 0 0 0 0-448z" fill="#4D5152" p-id="8423"></path></symbol><symbol id="icon-moon" viewBox="0 0 1024 1024"><path d="M611.370667 167.082667a445.013333 445.013333 0 0 1-38.4 161.834666 477.824 477.824 0 0 1-244.736 244.394667 445.141333 445.141333 0 0 1-161.109334 38.058667 85.077333 85.077333 0 0 0-65.066666 135.722666A462.08 462.08 0 1 0 747.093333 102.058667a85.077333 85.077333 0 0 0-135.722666 65.024z" fill="#FFB531" p-id="11345"></path><path d="M329.728 274.133333l35.157333-35.157333a21.333333 21.333333 0 1 0-30.165333-30.165333l-35.157333 35.157333-35.114667-35.157333a21.333333 21.333333 0 0 0-30.165333 30.165333l35.114666 35.157333-35.114666 35.157334a21.333333 21.333333 0 1 0 30.165333 30.165333l35.114667-35.157333 35.157333 35.157333a21.333333 21.333333 0 1 0 30.165333-30.165333z" fill="#030835" p-id="11346"></path></symbol></svg><!-- hexo injector head_end start --><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/tag_plugins.css" media="defer" onload="this.media='all'"><script src="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/carousel-touch.js"></script><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-filter-gitcalendar/lib/gitcalendar.css" media="print" onload="this.media='all'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"><link rel="alternate" href="/atom.xml" title="Certainly" type="application/atom+xml">
</head><body><div id="loading-box" onclick="document.getElementById(&quot;loading-box&quot;).classList.add(&quot;loaded&quot;)"><div class="loading-bg"><div class="loading-img"></div><div class="loading-image-dot"></div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://tuchuang.voooe.cn/images/2023/03/15/head.webp" onerror="onerror=null;src='/assets/r1.jpg'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">16</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">5</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">3</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-home"></use></svg><span class="menu_word" style="font-size:17px"> 首页</span></a></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--article"></use></svg><span class="menu_word" style="font-size:17px"> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-guidang1">                   </use></svg><span class="menu_word" style="font-size:17px"> 归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-sekuaibiaoqian">                   </use></svg><span class="menu_word" style="font-size:17px"> 标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-fenlei">                   </use></svg><span class="menu_word" style="font-size:17px"> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pinweishenghuo"></use></svg><span class="menu_word" style="font-size:17px"> 休闲</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/life/music/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-yinle">                   </use></svg><span class="menu_word" style="font-size:17px"> 八音盒</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/movies/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-dianying1">                   </use></svg><span class="menu_word" style="font-size:17px"> 影院</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/games/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-youxishoubing">                   </use></svg><span class="menu_word" style="font-size:17px"> 游戏</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xiangzi"></use></svg><span class="menu_word" style="font-size:17px"> 八宝箱</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/box/gallery/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-tubiaozhizuomoban">                   </use></svg><span class="menu_word" style="font-size:17px"> 画廊</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/animation/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-nvwumao">                   </use></svg><span class="menu_word" style="font-size:17px"> 动画</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/nav/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-zhifengche">                   </use></svg><span class="menu_word" style="font-size:17px"> 网址导航</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shejiaoxinxi"></use></svg><span class="menu_word" style="font-size:17px"> 社交</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/social/fcircle/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pengyouquan">                   </use></svg><span class="menu_word" style="font-size:17px"> 朋友圈</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/comments/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-liuyan">                   </use></svg><span class="menu_word" style="font-size:17px"> 留言板</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/social/link/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-lianjie">                   </use></svg><span class="menu_word" style="font-size:17px"> 友人帐</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-wangye"></use></svg><span class="menu_word" style="font-size:17px"> 网站</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/site/census/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--tongjibiao">                   </use></svg><span class="menu_word" style="font-size:17px"> 网站统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/echarts/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shujutongji1">                   </use></svg><span class="menu_word" style="font-size:17px"> 文章统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/time/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xianxingshalou">                   </use></svg><span class="menu_word" style="font-size:17px"> 旧时光</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-maoliang"></use></svg><span class="menu_word" style="font-size:17px"> 个人</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/personal/bb/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-qunliaotian">                   </use></svg><span class="menu_word" style="font-size:17px"> 唠叨</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/about/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-paperplane">                   </use></svg><span class="menu_word" style="font-size:17px"> 关于</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Certainly</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-home"></use></svg><span class="menu_word" style="font-size:17px"> 首页</span></a></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--article"></use></svg><span class="menu_word" style="font-size:17px"> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-guidang1">                   </use></svg><span class="menu_word" style="font-size:17px"> 归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-sekuaibiaoqian">                   </use></svg><span class="menu_word" style="font-size:17px"> 标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-fenlei">                   </use></svg><span class="menu_word" style="font-size:17px"> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pinweishenghuo"></use></svg><span class="menu_word" style="font-size:17px"> 休闲</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/life/music/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-yinle">                   </use></svg><span class="menu_word" style="font-size:17px"> 八音盒</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/movies/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-dianying1">                   </use></svg><span class="menu_word" style="font-size:17px"> 影院</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/life/games/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-youxishoubing">                   </use></svg><span class="menu_word" style="font-size:17px"> 游戏</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xiangzi"></use></svg><span class="menu_word" style="font-size:17px"> 八宝箱</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/box/gallery/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-tubiaozhizuomoban">                   </use></svg><span class="menu_word" style="font-size:17px"> 画廊</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/animation/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-nvwumao">                   </use></svg><span class="menu_word" style="font-size:17px"> 动画</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/box/nav/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-zhifengche">                   </use></svg><span class="menu_word" style="font-size:17px"> 网址导航</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shejiaoxinxi"></use></svg><span class="menu_word" style="font-size:17px"> 社交</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/social/fcircle/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-pengyouquan">                   </use></svg><span class="menu_word" style="font-size:17px"> 朋友圈</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/comments/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-liuyan">                   </use></svg><span class="menu_word" style="font-size:17px"> 留言板</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/social/link/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-lianjie">                   </use></svg><span class="menu_word" style="font-size:17px"> 友人帐</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-wangye"></use></svg><span class="menu_word" style="font-size:17px"> 网站</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/site/census/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon--tongjibiao">                   </use></svg><span class="menu_word" style="font-size:17px"> 网站统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/echarts/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-shujutongji1">                   </use></svg><span class="menu_word" style="font-size:17px"> 文章统计</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/site/time/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-xianxingshalou">                   </use></svg><span class="menu_word" style="font-size:17px"> 旧时光</span></a></li></ul></div><div class="menus_item"><a class="site-page group faa-parent animated-hover hide" href="javascript:void(0);"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-maoliang"></use></svg><span class="menu_word" style="font-size:17px"> 个人</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/personal/bb/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-qunliaotian">                   </use></svg><span class="menu_word" style="font-size:17px"> 唠叨</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/personal/about/"><svg class="menu_icon faa-tada" aria-hidden="true" style="width:1.30em;height:1.30em;vertical-align:-0.15em;fill:currentColor;overflow:hidden;"><use xlink:href="#icon-paperplane">                   </use></svg><span class="menu_word" style="font-size:17px"> 关于</span></a></li></ul></div></div><center id="name-container"><a id="page-name" href="javascript:scrollToTop()">PAGE_NAME</a></center><div id="nav-right"><div id="search-button"><a class="search faa-parent animated-hover" title="检索站内任何你想要的信息"><svg class="faa-tada icon" style="height:24px;width:24px;fill:currentColor;position:relative;top:6px" aria-hidden="true"><use xlink:href="#icon-valentine_-search-love-find-heart"></use></svg><span> 搜索</span></a></div><a class="meihua faa-parent animated-hover" onclick="toggleWinbox()" title="美化设置-自定义你的风格" id="meihua-button"><svg class="faa-tada icon" style="height:26px;width:26px;fill:currentColor;position:relative;top:8px" aria-hidden="true"><use xlink:href="#icon-tupian1"></use></svg></a><a class="sun_moon faa-parent animated-hover" onclick="switchNightMode()" title="浅色和深色模式转换" id="nightmode-button"><svg class="faa-tada" style="height:25px;width:25px;fill:currentColor;position:relative;top:7px" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon">       </use></svg></a><div id="toggle-menu"><a><i class="fas fa-bars fa-fw"></i></a></div></div></div></nav><div id="post-info"><h1 class="post-title">LVGL</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><svg class="meta_icon post-meta-icon" style="width:30px;height:30px;position:relative;top:10px"><use xlink:href="#icon-rili"></use></svg><span class="post-meta-label">发表于 </span><time class="post-meta-date-created" datetime="2023-09-30T14:00:40.000Z" title="发表于 2023-09-30 22:00:40">2023-09-30</time><span class="post-meta-separator">|</span><svg class="meta_icon post-meta-icon" style="width:18px;height:18px;position:relative;top:5px"><use xlink:href="#icon-gengxin1"></use></svg><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-11-21T09:07:11.187Z" title="更新于 2023-11-21 17:07:11">2023-11-21</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><svg class="meta_icon post-meta-icon" style="width:18px;height:18px;position:relative;top:5px"><use xlink:href="#icon-biaoqian"></use></svg><a class="post-meta-categories" href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F/">嵌入式</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><svg class="meta_icon post-meta-icon" style="width:25px;height:25px;position:relative;top:8px"><use xlink:href="#icon-charuword"></use></svg><span class="post-meta-label">字数总计:</span><span class="word-count">4227</span><span class="post-meta-separator">|</span><svg class="meta_icon post-meta-icon" style="width:20px;height:20px;position:relative;top:5px"><use xlink:href="#icon-shizhong"></use></svg><span class="post-meta-label">阅读时长:</span><span>15分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="LVGL"><svg class="meta_icon post-meta-icon" style="width:25px;height:25px;position:relative;top:5px"><use xlink:href="#icon-eye"></use></svg><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div><section class="main-hero-waves-area waves-area"><svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z"></path></defs><g class="parallax"><use href="#gentle-wave" x="48" y="0"></use><use href="#gentle-wave" x="48" y="3"></use><use href="#gentle-wave" x="48" y="5"></use><use href="#gentle-wave" x="48" y="7"></use></g></svg></section></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1>LVGL</h1>
<h3 id="部件创建">部件创建</h3>
<p>lv_scr_act()是获取默认显示的被激活的窗口</p>
<p><code>lv_obj_t * obj = lv_obj_create(lv_scr_act());</code></p>
<h3 id="常用部件">常用部件</h3>
<ol>
<li><code>lv_btn_create()</code>: 创建一个按钮控件。可以设置按钮的文本、图像、大小和对齐方式等属性，并为其添加单击事件处理函数。</li>
<li><code>lv_img_create()</code>: 创建一个图像控件。可以设置图像的源文件、显示模式和大小等属性。</li>
<li><code>lv_label_create()</code>: 创建一个文本标签控件。可以设置标签的文本内容和字体样式等属性。</li>
<li><code>lv_progress_create()</code>: 创建一个进度条控件。可以设置进度条的最大值、最小值和当前值等属性，并为其添加进度更新事件处理函数。</li>
<li><code>lv_slider_create()</code>: 创建一个滑动条控件。可以设置滑动条的最小值、最大值和当前值等属性，并为其添加滑动事件处理函数。</li>
<li><code>lv_switch_create()</code>: 创建一个开关按钮控件。可以设置开关按钮的文本和状态（开或关）等属性，并为其添加状态变化事件处理函数。</li>
<li><code>lv_textarea_create()</code>: 创建一个文本输入框控件。可以设置文本框的文本内容、字体和行数等属性，并为其添加文本输入事件处理函数。</li>
</ol>
<h3 id="部件属性">部件属性</h3>
<p>基本属性</p>
<ul>
<li>大小（size）</li>
<li>位置（position）</li>
<li>对齐（alignment）</li>
<li>样式（styles）</li>
<li>事件（events）</li>
</ul>
<h4 id="大小设置相关API">大小设置相关API</h4>
<p>设置宽度：<code>lv_obj_set_width(obj, new_width);</code></p>
<p>设置高度:	<code>lv_obj_set_height(obj, new_height);</code></p>
<p>同时设置宽度、高度：<code>lv_obj_set_size(obj, new_width, new_height);</code></p>
<h4 id="位置设置相关API">位置设置相关API</h4>
<p>设置X轴坐标：lv_obj_set_x(obj, new_x);</p>
<p>设置Y轴坐标：lv_obj_set_y(obj, new_y);</p>
<p>同时设置X、Y轴坐标：lv_obj_set_pos(obj, new_x, new_y);</p>
<h4 id="对齐设置相关API">对齐设置相关API</h4>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230919211510076.png" alt="image-20230919211510076"></p>
<p>参照父对象对齐：</p>
<p>lv_obj_set_align(obj, LV_ALIGN_…);</p>
<p>参照父对象对齐，再进行偏移：</p>
<p>lv_obj_align(obj, LV_ALIGN_…, x, y);</p>
<p>参照其他对象对齐（无父子关系），再进行偏移：</p>
<p>lv_obj_align_to(obj_to_align, obj_referece, LV_ALIGN_…, x, y);</p>
<p>​								基准对象		需要对齐的对象</p>
<h5 id="对齐模式">对齐模式</h5>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230919211805780.png" alt="image-20230919211805780"></p>
<h5 id="对齐参数">对齐参数</h5>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">lv_align: 这是一个枚举类型，用于表示控件的对齐方式。它包括以下值：</span><br><span class="line">LV_ALIGN_CENTER: 居中对齐。</span><br><span class="line">LV_ALIGN_TOP: 顶部对齐。</span><br><span class="line">LV_ALIGN_BOTTOM: 底部对齐。</span><br><span class="line">LV_ALIGN_LEFT: 左侧对齐。</span><br><span class="line">LV_ALIGN_RIGHT: 右侧对齐。</span><br><span class="line">lv<span class="constructor">_obj_set_align()</span>: 用于设置控件的对齐方式。它接受两个参数：控件指针和lv_align枚举值。例如：lv<span class="constructor">_obj_set_align(<span class="params">btn</span>, LV_ALIGN_CENTER)</span>;将按钮控件设置为居中对齐。</span><br><span class="line">lv<span class="constructor">_obj_set_pos()</span>: 用于设置控件的位置。它接受两个参数：控件指针和包含x和y坐标的lv_coord_t结构体。例如：lv<span class="constructor">_obj_set_pos(<span class="params">btn</span>, <span class="params">x</span>, <span class="params">y</span>)</span>;将按钮控件的位置设置为给定的x和y坐标。</span><br><span class="line">lv<span class="constructor">_obj_set_size()</span>: 用于设置控件的大小。它接受两个参数：控件指针和包含宽度和高度（使用lv_coord_t结构体）的数组。例如：lv<span class="constructor">_obj_set_size(<span class="params">btn</span>, <span class="params">w</span>, <span class="params">h</span>)</span>;将按钮控件的大小设置为给定的宽度w和高度h。</span><br><span class="line">lv<span class="constructor">_obj_set_margin()</span>: 用于设置控件的外边距。它接受四个参数：控件指针和包含上、右、下、左四个方向的外边距（使用lv_coord_t结构体）的数组。例如：lv<span class="constructor">_obj_set_margin(<span class="params">btn</span>, <span class="params">top</span>, <span class="params">right</span>, <span class="params">bottom</span>, <span class="params">left</span>)</span>;将按钮控件的上、右、下、左四个方向的外边距设置为给定的值。</span><br></pre></td></tr></table></figure>
<h4 id="样式设置">样式设置</h4>
<p>添加普通样式</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">static</span> <span class="type">lv_style_t</span> style; 									<span class="comment">/* 定义样式变量 */</span></span><br><span class="line">lv_style_init(&amp;style); 									<span class="comment">/* 初始化样式 */</span></span><br><span class="line">lv_style_set_bg_color(&amp;style, lv_color_hex(<span class="number">0xf4b183</span>)); 				<span class="comment">/* 设置背景颜色 */</span></span><br><span class="line"></span><br><span class="line"><span class="type">lv_obj_t</span> * obj = lv_obj_create(lv_scr_act()); 						<span class="comment">/* 创建一个部件 */</span></span><br><span class="line">lv_obj_add_style(obj, &amp; style, LV_STATE_DEFAULT); 					<span class="comment">/* 设置部件的样式 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>添加本地样式</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">lv_obj_t</span> * obj = lv_obj_create(lv_scr_act()); 						<span class="comment">/* 创建一个部件 */</span></span><br><span class="line">lv_obj_set_style_bg_color(obj, lv_color_hex(<span class="number">0xf4b183</span>),LV_STATE_DEFAULT);	<span class="comment">/* 设置部件的样式 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-复选框部件-font"><font color=#0x00aa00>复选框部件</font></h3>
<p>复选框部件常用于选择某个内容的开启和关闭，可以理解为自带标签的开关</p>
<h4 id="复选框组成">复选框组成</h4>
<ul>
<li>主体(LV_PART_MAIN)</li>
<li>勾选框(LV_PART_INDICATOR)</li>
</ul>
<h4 id="复选框创建">复选框创建</h4>
<p><code>lv_obj_t *check_box = lv_checkbox_create(parent);</code></p>
<h4 id="复选框文本设置">复选框文本设置</h4>
<pre><code>lv_checkbox_set_text(check_box,&quot;Genshin Start&quot;);			//设置文本内容
lv_obj_set_style_pad_column(check_box,50,LV_STATE_DEFAULT);	//设置勾选框和文本的间距
</code></pre>
<p>添加、清除复选框状态</p>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_obj_add_state(<span class="params">check_box</span>,LV_STATE_CHECKED |LV_STATE_DISABLED)</span>;	<span class="comment">//添加状态：默认选中且不可被修改</span></span><br><span class="line">lv<span class="constructor">_obj_clear_state(<span class="params">check_box</span>,LV_STATE_CHECKED |LV_STATE_DISABLED)</span>;	<span class="comment">//清除复选框状态</span></span><br></pre></td></tr></table></figure>
<p>获取复选框状态</p>
<p>lv_obj_has_state(check_box, LV_STATE_CHECKED);	//返回值：选中 1    非选中 0</p>
<h3 id="font-color-0x00aa00-进度条部件-font"><font color=#0x00aa00>进度条部件</font></h3>
<ul>
<li>主体(LV_PART_MAIN)</li>
<li>指示器(LV_PART_INDICATOR)</li>
</ul>
<h4 id="进度条创建">进度条创建</h4>
<p><code>lv_obj_t *bar = lv_bar_create(parent);</code></p>
<h4 id="进度条大小、当前值和范围值设置">进度条大小、当前值和范围值设置</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">lv_obj_set_size(bar,<span class="number">300</span>,<span class="number">30</span>);				<span class="comment">//设置进度条的大小（x，y），如果水平长度&lt;垂直长度，则进度条会以垂直方式													显示</span></span><br><span class="line">lv_bar_set_value(bar,<span class="number">80</span>,LV_ANIM_ON);	<span class="comment">//设置进度条的当前值，默认范围为0-100，LV_ANIM_ON表示开启动画效果</span></span><br><span class="line">lv_bar_set_range(bar,<span class="number">0</span>,<span class="number">100</span>);			<span class="comment">//设置进度条的范围</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="设置动画时间">设置动画时间</h4>
<p><code>  lv_obj_set_style_anim_time(bar,1000,LV_STATE_DEFAULT);</code></p>
<blockquote>
<p>1000表示1000ms，同时动画时间设置必须放在当前值设置之前</p>
</blockquote>
<h4 id="定时器创建">定时器创建</h4>
<p><code>lv_timer_create(timer_cb,100,NULL);</code></p>
<ul>
<li><code>time_cb</code>是定时器回调函数</li>
<li>100是延时100ms</li>
<li>NULL表示参数为空</li>
</ul>
<p>定时器回调函数</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">void</span> <span class="title function_">timer_cb</span><span class="params">(<span class="type">lv_timer_t</span> *timer)</span></span><br><span class="line">&#123;</span><br><span class="line">	<span class="comment">//内容</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="进度条数值获取">进度条数值获取</h4>
<p><code>lv_bar_get_value(bar)；</code></p>
<h4 id="进度条GET宏">进度条GET宏</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*=====================</span></span><br><span class="line"><span class="comment"> * Getter functions</span></span><br><span class="line"><span class="comment"> *====================*/</span></span><br><span class="line"></span><br><span class="line"><span class="type">int32_t</span> <span class="title function_">lv_bar_get_value</span><span class="params">(<span class="type">const</span> <span class="type">lv_obj_t</span> * obj)</span></span><br><span class="line"><span class="type">int32_t</span> <span class="title function_">lv_bar_get_start_value</span><span class="params">(<span class="type">const</span> <span class="type">lv_obj_t</span> * obj)</span></span><br><span class="line"><span class="type">int32_t</span> <span class="title function_">lv_bar_get_min_value</span><span class="params">(<span class="type">const</span> <span class="type">lv_obj_t</span> * obj)</span></span><br><span class="line"><span class="type">int32_t</span> <span class="title function_">lv_bar_get_max_value</span><span class="params">(<span class="type">const</span> <span class="type">lv_obj_t</span> * obj)</span></span><br><span class="line"><span class="type">lv_bar_mode_t</span> <span class="title function_">lv_bar_get_mode</span><span class="params">(<span class="type">lv_obj_t</span> * obj)</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-加载器部件-font"><font color=#0x00aa00>加载器部件</font></h3>
<h4 id="加载器组成">加载器组成</h4>
<ul>
<li>主体(LV_PART_MAIN)</li>
<li>指示器(LV_PART_INDICATOR)</li>
<li>手柄(LV_PART_KNOB)</li>
</ul>
<h4 id="加载器创建">加载器创建</h4>
<p><code> lv_obj_t *spinner = lv_spinner_create(parent,time,lenght);</code></p>
<blockquote>
<p>time默认为ms，代表一个旋转周期需要的时长</p>
<p>length表示加载条长度</p>
</blockquote>
<h4 id="设置圆弧颜色">设置圆弧颜色</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv_obj_set_style_arc_color(spinner,lv_color_hex(<span class="number">0x66ccff</span>),LV_PART_MAIN);    <span class="comment">/*设置主体圆弧颜色*/</span></span><br><span class="line">lv_obj_set_style_arc_color(spinner,lv_color_hex(<span class="number">0x66ccff</span>),LV_PART_INDICATOR); <span class="comment">//设置指示器圆弧颜色</span></span><br></pre></td></tr></table></figure>
<h4 id="设置圆弧宽度">设置圆弧宽度</h4>
<pre><code>lv_obj_set_style_arc_width(spinner,30,LV_PART_MAIN);    //设置主体圆弧宽度
lv_obj_set_style_arc_width(spinner,30,LV_PART_INDICATOR);   //设置指示器圆弧宽度
</code></pre>
<h3 id="font-color-0x00aa00-LED部件-font"><font color=#0x00aa00>LED部件</font></h3>
<h4 id="LED创建">LED创建</h4>
<p><code> lv_obj_t *led = lv_led_create(parent);</code></p>
<h4 id="LED颜色及亮度设置">LED颜色及亮度设置</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//设置LED颜色</span></span><br><span class="line">lv_led_set_color(led,lv_color_hex(<span class="number">0x66ccff</span>));</span><br><span class="line"><span class="comment">//设置LED亮度，0-255</span></span><br><span class="line">lv_led_set_brightness(led,<span class="number">125</span>);</span><br></pre></td></tr></table></figure>
<h4 id="LED状态设置">LED状态设置</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//设置LED状态</span></span><br><span class="line">lv_led_on(led);     <span class="comment">//打开LED（设置亮度为255）</span></span><br><span class="line">lv_led_off(led);    <span class="comment">//关闭LED（设置亮度为0）</span></span><br><span class="line"><span class="comment">//打开、关闭LED时亮度不是绝对的0、255，具体要看宏定义</span></span><br><span class="line"></span><br><span class="line">lv_led_toggle(led); <span class="comment">//翻转LED状态</span></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-列表组件-font"><font color=#0x00aa00>列表组件</font></h3>
<p>默认展示多个选项</p>
<p>组成</p>
<ul>
<li>主体(LV_PART_MAIN)</li>
<li>滚动条(LV_PART_SCROLLBAR)</li>
</ul>
<h4 id="创建列表组件">创建列表组件</h4>
<p><code>lv_obj_t *list = lv_list_create(parent);</code></p>
<h4 id="添加列表文本">添加列表文本</h4>
<p><code>lv_list_add_text(list,&quot;SETTING&quot;);</code></p>
<h4 id="添加列表按钮">添加列表按钮</h4>
<p><code> lv_obj_t *btn = lv_list_add_btn(list,LV_SYMBOL_WIFI,&quot;WLAN&quot;);</code></p>
<ul>
<li>list:列表对象</li>
<li>LV_SYMBOL_WIFI:图标（WIFI）</li>
<li>text:按钮文本</li>
</ul>
<h4 id="获取列表按钮文本">获取列表按钮文本</h4>
<p><code> lv_list_get_btn_text(list,btn);</code></p>
<p>list：列表对象</p>
<p>btn：列表对象中的按钮对象</p>
<h3 id="font-color-0x00aa00-下拉列表部件-font"><font color=#0x00aa00>下拉列表部件</font></h3>
<p>常用于多选一，点击后可展现多个选项</p>
<h4 id="组成">组成</h4>
<ul>
<li>按钮（BUTTON）</li>
<li>列表（LIST）</li>
</ul>
<h4 id="创建下拉列表组件">创建下拉列表组件</h4>
<p><code>lv_obj_t *drop =lv_dropdown_create(parent);</code></p>
<h4 id="设置选项内容">设置选项内容</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_dropdown_set_options(<span class="params">drop</span>,<span class="string">&quot;fbk\nmatsuri\nayame\nhareru&quot;</span>)</span>;    <span class="comment">/**设置选项**/</span></span><br><span class="line">lv<span class="constructor">_dropdown_set_option_static(<span class="params">drop</span>,<span class="string">&quot;fbk\nmatsuri\nayame\nhareru&quot;</span>)</span>;    <span class="comment">/**设置静态选项**/</span></span><br><span class="line">lv<span class="constructor">_dropdown_add_option(<span class="params">drop</span>,<span class="string">&quot;ui&quot;</span>,4)</span>;							<span class="comment">//添加选项，4表示索引，从0开始</span></span><br></pre></td></tr></table></figure>
<h4 id="设置当前所选项">设置当前所选项</h4>
<p><code>  lv_dropdown_set_selected(drop,3);</code>   /<strong>设置当前所选项，索引从0开始</strong>/</p>
<h4 id="获取选项内容">获取选项内容</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv_dropdown_get_selected(drop);	<span class="comment">//获取索引值</span></span><br><span class="line"><span class="type">char</span> buf[]</span><br><span class="line">lv_dropdown_get_selected_str( drop, buf, <span class="keyword">sizeof</span>(buf));<span class="comment">//获取选项文本内容</span></span><br></pre></td></tr></table></figure>
<h4 id="设置方向和图标">设置方向和图标</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_dropdown_set_dir(<span class="params">dd</span>, LV_DIR_RIGHT)</span>;				<span class="comment">/* 设置列表展开方向 */</span></span><br><span class="line">lv<span class="constructor">_dropdown_set_symbol(<span class="params">dd</span>, LV_SYMBOL_RIGHT)</span>;			<span class="comment">/* 设置图标 */</span></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-滚轮部件-font"><font color=#0x00aa00>滚轮部件</font></h3>
<p>常用于多选一，以滚轮形式显示多个选项</p>
<p>样式</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922092341711.png" alt="image-20230922092341711"></p>
<h4 id="组成-2">组成</h4>
<ul>
<li>主体(LV_PART_MAIN)</li>
<li>选项框(LV_PART_SELECTED)</li>
</ul>
<h4 id="创建滚轮部件">创建滚轮部件</h4>
<p><code> lv_roller_create(parent);</code></p>
<h4 id="设置选项间隔">设置选项间隔</h4>
<p><code>lv_obj_set_style_text_line_space(roller, 30, LV_STATE_DEFAULT); </code></p>
<h4 id="设置选项内容、滚动模式">设置选项内容、滚动模式</h4>
<p><code>lv_roller_set_options(roller,&quot;sec-1\nsec-2\nsec-3\nsec-4\nsec-5&quot;,LV_ROLLER_MODE_NORMAL);</code>	//正常模式</p>
<h4 id="设置当前所选项-2">设置当前所选项</h4>
<p><code> lv_roller_set_selected(roller, 3, LV_ANIM_ON);</code></p>
<h4 id="设置可见行数">设置可见行数</h4>
<p><code>lv_roller_set_visible_row_count(roller, 2);</code></p>
<h4 id="获取选项内容-2">获取选项内容</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv_roller_get_selected(roller);								<span class="comment">/* 获取索引 */</span></span><br><span class="line"><span class="type">char</span> buf[<span class="number">10</span>];</span><br><span class="line">lv_roller_get_selected_str(roller, buf, <span class="keyword">sizeof</span>(buf));					<span class="comment">/* 获取选项文本 */</span></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-滑块部件-font"><font color=#0x00aa00>滑块部件</font></h3>
<p>常用于调节某个参数的值，以直线滑动形式来修改数值</p>
<h4 id="样式">样式</h4>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922092407309.png" alt="image-20230922092407309"></p>
<h4 id="组成-3">组成</h4>
<ul>
<li>
<p>主体(LV_PART_MAIN）</p>
</li>
<li>
<p>指示器(LV_PART_INDICATOR)</p>
</li>
<li>
<p>旋钮(LV_PART_KNOB)</p>
</li>
</ul>
<h4 id="创建滑块部件">创建滑块部件</h4>
<p><code>lv_obj_t  *slider = lv_slider_create( parent );</code></p>
<h4 id="设置大小、当前值、范围值">设置大小、当前值、范围值</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_obj_set_size(<span class="params">slider</span>, 20, 200)</span>;						<span class="comment">/* 高度&gt;宽度时，滑块为纵向 */</span></span><br><span class="line">lv<span class="constructor">_slider_set_value(<span class="params">slider</span>, 50, LV_ANIM_OFF)</span>;				<span class="comment">/* 设置当前值 */</span></span><br><span class="line">lv<span class="constructor">_slider_set_range(<span class="params">slider</span>, -100, 100)</span>;					<span class="comment">/* 设置范围值 */</span></span><br></pre></td></tr></table></figure>
<h4 id="获取当前值">获取当前值</h4>
<p><code>lv_slider_get_value(slider);</code></p>
<h4 id="模式设置">模式设置</h4>
<p><code>lv_slider_set_mode(slider, LV_SLIDER_MODE_...);</code></p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922092540337.png" alt="image-20230922092540337"></p>
<h4 id="设置、获取左值">设置、获取左值</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv_slider_set_left_value(slider, <span class="number">20</span>, LV_ANIM_OFF);					<span class="comment">/* 设置左值 */</span></span><br><span class="line">lv_slider_get_left_value(slider);								<span class="comment">/* 获取左值 */</span></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-圆弧部件-font"><font color=#0x00aa00>圆弧部件</font></h3>
<p>圆弧部件以弧形滑动的形式来调节、显示某个参数的值。</p>
<h4 id="样式-2">样式</h4>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922092642727.png" alt="image-20230922092642727"></p>
<h4 id="组成-4">组成</h4>
<ul>
<li>背景弧(LV_PART_MAIN）</li>
<li>前景弧(LV_PART_INDICATOR)</li>
<li>旋钮(LV_PART_KNOB)</li>
</ul>
<h4 id="创建圆弧部件">创建圆弧部件</h4>
<p><code>lv_obj_t  *arc = lv_arc_create( parent );</code></p>
<h4 id="设置当前值、范围值">设置当前值、范围值</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_arc_set_value(<span class="params">arc</span>, 80)</span>;							<span class="comment">/* 设置当前值（需要在范围值之内）*/</span></span><br><span class="line">lv<span class="constructor">_arc_set_range(<span class="params">arc</span>, 0, 200)</span>;						<span class="comment">/* 设置范围值 */</span></span><br></pre></td></tr></table></figure>
<h4 id="设置圆弧角度">设置圆弧角度</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_arc_set_angles(<span class="params">arc</span>, 135, 270)</span>;						<span class="comment">/* 设置前景弧角度 */</span></span><br><span class="line">lv<span class="constructor">_arc_set_bg_angles(<span class="params">arc</span>, 135, 45)</span>;					<span class="comment">/* 设置背景弧角度 */</span></span><br></pre></td></tr></table></figure>
<h4 id="圆弧角度设置范围">圆弧角度设置范围</h4>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922092807429.png" alt="image-20230922092807429"></p>
<h4 id="设置旋转角度">设置旋转角度</h4>
<p><code>lv_arc_set_rotation(arc, 180);</code></p>
<h4 id="获取当前值-2">获取当前值</h4>
<p><code>lv_arc_get_value(arc);</code></p>
<h4 id="设置模式、圆弧绘制速率">设置模式、圆弧绘制速率</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_arc_set_mode(<span class="params">arc</span>, LV_ARC_MODE_REVERSE)</span>;				<span class="comment">/* 设置模式 */</span></span><br><span class="line">lv<span class="constructor">_arc_set_change_rate(<span class="params">arc</span>, 90)</span>;							<span class="comment">/* 绘制速率：90°/秒 */</span></span><br></pre></td></tr></table></figure>
<h4 id="去除按钮">去除按钮</h4>
<p><code>lv_obj_remove_style(arc_r,NULL,LV_PART_KNOB);</code>       //去除旋钮，同样适用于其他有按钮的部件</p>
<h3 id="font-color-0x00aa00-线条部件-font"><font color=#0x00aa00>线条部件</font></h3>
<p>组成</p>
<p>主体(LV_PART_MAIN）</p>
<p>创建线条部件</p>
<p>lv_obj_t  *line = lv_line_create( parent );</p>
<h3 id="font-color-0x00aa00-图片部件-font"><font color=#0x00aa00>图片部件</font></h3>
<p>组成部分</p>
<p>主体(LV_PART_MAIN）</p>
<p>创建图片部件</p>
<p>lv_obj_t *img = lv_img_create( parent );</p>
<p>设置图片源</p>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="constructor">LV_IMG_DECLARE(<span class="params">img_bird</span>)</span>;				<span class="comment">/* 声明图片 */</span></span><br><span class="line">lv<span class="constructor">_img_set_src(<span class="params">img</span>, &amp;<span class="params">img_bird</span>)</span>;			<span class="comment">/* 设置图片源 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>设置图片偏移</p>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_img_set_offset_x(<span class="params">img</span>, 100)</span>;				<span class="comment">/* x轴偏移100 */</span></span><br><span class="line">lv<span class="constructor">_img_set_offset_y(<span class="params">img</span>, 20)</span>; 				<span class="comment">/* y轴偏移20 */</span></span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922141437353.png" alt="image-20230922141437353"></p>
<p>黄色区域为x轴偏移20范围后补上的部分，蓝色部分为y轴偏移50像素后补上的部分</p>
<p>图片重新着色</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv_obj_set_style_img_recolor(img, lv_color_hex(<span class="number">0xffe1d2</span>), LV_PART_MAIN); </span><br><span class="line">lv_obj_set_style_img_recolor_opa(img, <span class="number">150</span>, LV_PART_MAIN);</span><br></pre></td></tr></table></figure>
<p>默认透明度为0，需要重新设置透明度</p>
<p>设置图片缩放、旋转</p>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_img_set_zoom(<span class="params">img</span>, 512)</span>; <span class="comment">/* 放大2倍 */</span></span><br><span class="line"></span><br><span class="line">lv<span class="constructor">_img_set_angle(<span class="params">img</span>, 900)</span>; <span class="comment">/* 顺时针方向旋转90° */</span></span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922141924826.png" alt="image-20230922141924826"></p>
<p>设置中心点</p>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_obj_update_layout(<span class="params">img</span>)</span>;		<span class="comment">/* 更新图片布局信息 */</span></span><br><span class="line">lv<span class="constructor">_img_set_pivot(<span class="params">img</span>, 0, 0)</span>;		<span class="comment">/* 设置中心点 */</span></span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230922142003292.png" alt="image-20230922142003292"></p>
<h3 id="色环部件">色环部件</h3>
<h3 id="font-color-0x00aa00-按钮矩阵部件-font"><font color=#0x00aa00>按钮矩阵部件</font></h3>
<p>在不同的行和列中显示多个轻量级按钮</p>
<h4 id="组成部分">组成部分</h4>
<ul>
<li>主体(LV_PART_MAIN）</li>
<li>按钮(LV_PART_ITEMS)</li>
</ul>
<h4 id="创建按钮矩阵部件">创建按钮矩阵部件</h4>
<p>lv_obj_t *btnm = lv_btnmatrix_create(parent);</p>
<h4 id="设置按钮数量、文本">设置按钮数量、文本</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">static</span> <span class="type">const</span> <span class="type">char</span> *btn_mx[]=&#123;<span class="string">&quot;btn1&quot;</span>,<span class="string">&quot;\n&quot;</span>,<span class="string">&quot;btn2&quot;</span>,<span class="string">&quot;\n&quot;</span>,<span class="string">&quot;btn3&quot;</span>,<span class="string">&quot;&quot;</span>&#125;;	<span class="comment">/* 定义按钮数组，最后一个元素必须为空 */</span></span><br><span class="line">lv_btnmatrix_set_map(btnm,btn_mx);					<span class="comment">/* 设置按钮 */</span></span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923091147173.png" alt="image-20230923091147173"></p>
<h4 id="设置按钮相对宽度">设置按钮相对宽度</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">static</span> <span class="type">const</span> <span class="type">char</span> *btn_mx[]=&#123;<span class="string">&quot;btn1&quot;</span>,<span class="string">&quot;\n&quot;</span>,<span class="string">&quot;btn2&quot;</span>,<span class="string">&quot;btn3&quot;</span>,<span class="string">&quot;\n&quot;</span>,<span class="string">&quot;btn4&quot;</span>,<span class="string">&quot;btn5&quot;</span>,<span class="string">&quot;&quot;</span>&#125;;</span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment">lv_btnmatrix_set_btn_width(btnm, id, width);			/* 索引 (id) 从0开始，宽度1~7 ( 默认为1 ) */</span></span><br><span class="line">**/</span><br><span class="line">lv_btnmatrix_set_btn_width(btnm,<span class="number">3</span>,<span class="number">1</span>);		<span class="comment">//将按钮4相对宽度设为1</span></span><br><span class="line">lv_btnmatrix_set_btn_width(btnm,<span class="number">4</span>,<span class="number">2</span>);		<span class="comment">//将按钮5相对宽度设为2</span></span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923091759712.png" alt="image-20230923091759712"></p>
<h4 id="获取按钮索引、文本">获取按钮索引、文本</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">lv_btnmatrix_get_selected_btn(btnm);					<span class="comment">/* 获取索引 */</span></span><br><span class="line">lv_btnmatrix_get_btn_text(btnm, id);					<span class="comment">/* 获取文本 */</span></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment">例程</span></span><br><span class="line"><span class="comment">**/</span></span><br><span class="line"><span class="type">uint8_t</span> id;</span><br><span class="line">id =lv_btnmatrix_get_selected_btn(target);</span><br><span class="line"></span><br><span class="line"><span class="built_in">printf</span>(<span class="string">&quot;******\nid = [%d]\nText = &#123;%s&#125;\n******\n&quot;</span>,id,lv_btnmatrix_get_btn_text(target,id));</span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923093716727.png" alt="image-20230923093716727"></p>
<h4 id="设置、清除按钮属性">设置、清除按钮属性</h4>
<p><code>lv_btnmatrix_set_btn_ctrl(btnm, id, LV_BTNMATRIX_CTRL_...); </code> /* 设置单个按钮属性 */</p>
<p><code>lv_btnmatrix_clear_btn_ctrl(btnm, id, LV_BTNMATRIX_CTRL_...); </code> /* 清除单个按钮属性 */</p>
<p><code>lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_...);  </code>  /* 设置所有按钮属性 */</p>
<h5 id="属性枚举">属性枚举</h5>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">enum</span> &#123;</span></span><br><span class="line">    LV_BTNMATRIX_CTRL_HIDDEN, 						<span class="comment">/* 隐藏 */</span></span><br><span class="line">    LV_BTNMATRIX_CTRL_DISABLED,						<span class="comment">/* 失能 */</span></span><br><span class="line">    LV_BTNMATRIX_CTRL_CHECKABLE, 					<span class="comment">/* 允许状态切换 */</span></span><br><span class="line">    LV_BTNMATRIX_CTRL_RECOLOR, 						<span class="comment">/* 允许文本重新着色 */</span></span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>文本着色配置：#{颜色16进制参数} {空格} {按钮文本}#</p>
<p><code>static const char *btn_mx[]=&#123;&quot;#66ccff btn1#&quot;,&quot;\n&quot;,&quot;btn2&quot;,&quot;btn3&quot;,&quot;\n&quot;,&quot;btn4&quot;,&quot;btn5&quot;,&quot;&quot;&#125;;</code></p>
</blockquote>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923095217209.png" alt="image-20230923095217209"></p>
<p>设置单次选中属性</p>
<p><code>lv_btnmatrix_set_one_checked(btnm, true);</code>  /* 注意：需要先设置允许状态切换属性 */</p>
<p>TIP</p>
<p><code>lv_obj_set_style_border_width(btnm,0,LV_PART_MAIN);</code>	//去除主体边框</p>
<p><code>lv_obj_set_style_bg_opa(btnm,0,LV_PART_MAIN);</code>	//设置主体背景透明度</p>
<p><code>lv_obj_set_style_bg_opa(btnm,0,LV_PART_ITEMS);</code> //设置按钮背景透明度</p>
<p><code>lv_obj_set_style_shadow_width(btnm,0,LV_PART_ITEMS);</code> //去除按钮阴影</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923100856929.png" alt="image-20230923100856929"></p>
<h3 id="font-color-0x00aa00-文本区域部件-font"><font color=#0x00aa00>文本区域部件</font></h3>
<h4 id="组成-5">组成</h4>
<ul>
<li>主体(LV_PART_MAIN）</li>
<li>滚动条(LV_PART_SCROLLBAR)</li>
<li>所选文本(LV_PART_SELECTED）</li>
<li>光标(LV_PART_CURSOR)</li>
<li>占位符(TEXTAREA_PLACEHOLDER)</li>
</ul>
<h4 id="创建文本区域部件">创建文本区域部件</h4>
<p><code>lv_obj_t *ta = lv_textarea_create(parent);</code></p>
<h4 id="添加文本">添加文本</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_textarea_add_char(<span class="params">ta</span>, &#x27;A&#x27;)</span>; <span class="comment">/* 添加一个字符到当前光标处 */</span></span><br><span class="line"></span><br><span class="line">lv<span class="constructor">_textarea_add_text(<span class="params">ta</span>, <span class="string">&quot;BCDEF&quot;</span>)</span>;  <span class="comment">/* 添加字符串到当前光标处 */</span></span><br><span class="line">lv_obj_t *keyboard = lv<span class="constructor">_keyboard_create(<span class="params">lv_scr_act</span>()</span>);	<span class="comment">/* 创建键盘部件 */</span></span><br><span class="line">lv<span class="constructor">_keyboard_set_textarea(<span class="params">keyboard</span>, <span class="params">ta</span>)</span>;			<span class="comment">/* 关联键盘和文本区域部件 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="设置光标位置">设置光标位置</h4>
<p><code>lv_textarea_set_cursor_pos(ta, 0);</code> /* 0：最左侧， LV_TEXTAREA_CURSOR_LAST：最右侧 */</p>
<h4 id="删除文本">删除文本</h4>
<figure class="highlight reasonml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv<span class="constructor">_textarea_del_char(<span class="params">ta</span>)</span>;							<span class="comment">/* 删除光标左侧的一个字符 */</span></span><br><span class="line">lv<span class="constructor">_textarea_del_char_forward(<span class="params">ta</span>)</span>;					<span class="comment">/* 删除光标右侧的一个字符 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="设置模式">设置模式</h4>
<p><code>lv_textarea_set_one_line(ta, true); </code>/* 单行模式 */</p>
<p><code>lv_textarea_set_password_mode(ta, true); </code>/* 密码模式（隐藏输入的内容） */</p>
<p><code>lv_textarea_set_password_show_time(ta, 100); </code>/* 密码显示时间 */</p>
<h4 id="限制字符输入">限制字符输入</h4>
<p><code>lv_textarea_set_accepted_chars(ta,&quot;0123456789&quot;); </code>  /* 限制接收的字符 */</p>
<p><code>lv_textarea_set_max_length(ta,6);</code>   /* 限制字符长度 */</p>
<h4 id="设置占位符">设置占位符</h4>
<p><code>lv_textarea_set_placeholder_text(ta, &quot;password&quot;); </code>  /* 提示输入密码 */</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923152651352.png" alt="image-20230923152651352"></p>
<h4 id="获取文本">获取文本</h4>
<p><code>const char *txt = lv_textarea_get_text(ta);</code>  /* 获取文本框文本 */</p>
<h4 id="比对文本内容">比对文本内容</h4>
<p><code>strcmp(const char *s1,const char *s2);</code> /* 当s1=s2时，返回0 */</p>
<h4 id="通过键盘在多个文本区域中写入数据">通过键盘在多个文本区域中写入数据</h4>
<p>可以通过获取文本区域聚焦状态，将获取到的部件传给键盘绑定函数，从而完成键盘的动态绑定</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923154457473.png" alt="image-20230923154457473"></p>
<h3 id="font-color-0x00aa00-键盘部件-font"><font color=#0x00aa00>键盘部件</font></h3>
<p>键盘部件可用于输入文本内容，其本质上就是一个特殊的按钮矩阵。</p>
<h4 id="组成-6">组成</h4>
<ul>
<li>主体(LV_PART_MAIN）</li>
<li>按钮(LV_PART_ITEMS)</li>
</ul>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230923163700824.png" alt="image-20230923163700824"></p>
<h4 id="创建键盘部件">创建键盘部件</h4>
<p><code>lv_obj_t *kb = lv_keyboard_create(parent);</code></p>
<h4 id="关联文本框">关联文本框</h4>
<p><code>lv_obj_t *ta = lv_textarea_create(lv_scr_act());</code> /* 创建文本区域部件 */</p>
<p><code>lv_keyboard_set_textarea(kb, ta); </code>/* 关联键盘和文本区域部件 */</p>
<h4 id="设置按键弹窗">设置按键弹窗</h4>
<p><code>lv_keyboard_set_popovers(kb, true);</code> /* 允许按键弹窗提示 */</p>
<h4 id="设置键盘模式">设置键盘模式</h4>
<p><code>lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER); </code>/* 数字键盘模式 */</p>
<h5 id="键盘模式">键盘模式</h5>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/** Current keyboard mode.*/</span></span><br><span class="line"><span class="class"><span class="keyword">enum</span> &#123;</span></span><br><span class="line">    LV_KEYBOARD_MODE_TEXT_LOWER,</span><br><span class="line">    LV_KEYBOARD_MODE_TEXT_UPPER,</span><br><span class="line">    LV_KEYBOARD_MODE_SPECIAL,</span><br><span class="line">    LV_KEYBOARD_MODE_NUMBER,</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<h4 id="切换数字键盘和小写键盘">切换数字键盘和小写键盘</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">static</span> <span class="type">void</span> <span class="title function_">key_event</span><span class="params">(<span class="type">lv_event_t</span> *ev)</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="type">lv_event_code_t</span> code = lv_event_get_code(ev);</span><br><span class="line">    <span class="type">lv_obj_t</span> *target = lv_event_get_target(ev);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span>(code == LV_EVENT_VALUE_CHANGED)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="type">uint16_t</span> id =lv_btnmatrix_get_selected_btn(target);     <span class="comment">//获取键盘索引按钮</span></span><br><span class="line">        <span class="type">const</span> <span class="type">char</span> *btn_txt = lv_btnmatrix_get_btn_text(target,id); <span class="comment">//获取键盘按钮内容</span></span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;%s\n&quot;</span>,btn_txt);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span>(!<span class="built_in">strcmp</span>(btn_txt,LV_SYMBOL_KEYBOARD))      <span class="comment">//判断是不是键盘按钮被按下</span></span><br><span class="line">        &#123;</span><br><span class="line">            <span class="keyword">if</span>(lv_keyboard_get_mode(target) == LV_KEYBOARD_MODE_NUMBER)     <span class="comment">//获取当前键盘模式，</span></span><br><span class="line">                                                                            <span class="comment">//    如果是数字模式就切换小写模式</span></span><br><span class="line">            &#123;</span><br><span class="line">                lv_keyboard_set_mode(target,LV_KEYBOARD_MODE_TEXT_LOWER);   <span class="comment">//切换小写字母模式</span></span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">else</span>&#123;</span><br><span class="line">              lv_keyboard_set_mode(target,LV_KEYBOARD_MODE_NUMBER);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-图片按钮部件-font"><font color=#0x00aa00>图片按钮部件</font></h3>
<p>和按钮部件类似，可以设置图片</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131011667.png" alt="image-20230930131011667"></p>
<h4 id="组成-7">组成</h4>
<p>主体(LV_PART_MAIN）</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131116092.png" alt="image-20230930131116092"></p>
<h4 id="创建图片按钮部件">创建图片按钮部件</h4>
<p><code>lv_obj_t *imgbtn = lv_imgbtn_create(parent);</code></p>
<h4 id="设置图片源、按钮大小">设置图片源、按钮大小</h4>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">lv_imgbtn_set_src(imgbtn, LV_IMGBTN_STATE_..., src_left, src_mid, src_right);		<span class="comment">/* 设置某个状态的图片源 */</span></span><br><span class="line">lv_obj_set_size(imgbtn, <span class="number">64</span> * <span class="number">3</span>, <span class="number">64</span>);								<span class="comment">/* 设置图片按钮大小 */</span></span><br></pre></td></tr></table></figure>
<h4 id="设置按钮状态">设置按钮状态</h4>
<p><code>lv_imgbtn_set_state(imgbtn, LV_IMGBTN_STATE_PRESSED); </code>/* 设置按下状态 */</p>
<h4 id="设置图片透明度通道">设置图片透明度通道</h4>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">①  准备一张带有透明度通道的图片</span><br><span class="line">②  官方图片转换工具中，色彩格式选择：<span class="built_in">CF_TRUE_COLOR_ALPHA</span></span><br><span class="line">③  声明图片并调用即可</span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-选项卡部件-font"><font color=#0x00aa00>选项卡部件</font></h3>
<p>多页面切换，在不同页面添加内容</p>
<h4 id="组成-8">组成</h4>
<ul>
<li>主体（lv_obj）</li>
<li>按钮（lv_btnmatrix)</li>
</ul>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230925090452426.png" alt="image-20230925090452426"></p>
<h4 id="创建选项卡部件">创建选项卡部件</h4>
<p><code>lv_obj_t *tabview = lv_tabview_create(parent, LV_DIR_..., tab_size);</code></p>
<blockquote>
<p>枚举参数 LV_DIR…为按钮位置</p>
<p>tab_size为按钮高度</p>
</blockquote>
<h4 id="添加选项卡">添加选项卡</h4>
<p><code>lv_obj_t *tab1 = lv_tabview_add_tab(tabview, &quot;Tab 1&quot;);</code></p>
<p><code>lv_obj_t *tab2 = lv_tabview_add_tab(tabview, &quot;Tab 2&quot;);</code></p>
<h4 id="设置当前选中的选项卡">设置当前选中的选项卡</h4>
<p><code>lv_tabview_set_act(tabview, 0, LV_ANIM_OFF);</code>  /* 索引从0开始 */</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230925092738854.png" alt="image-20230925092738854"></p>
<h3 id="font-color-0x00aa00-平铺视图部件-font"><font color=#0x00aa00>平铺视图部件</font></h3>
<p>实现不同方向的页面切换</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230925093019823.png" alt="image-20230925093019823"></p>
<h4 id="组成-9">组成</h4>
<p>主体(LV_PART_MAIN）</p>
<p>滚动条(LV_PART_SCROLLBAR)</p>
<h4 id="创建平铺视图部件">创建平铺视图部件</h4>
<p><code>lv_obj_t *tileview = lv_tileview_create( parent );</code></p>
<h4 id="添加页面">添加页面</h4>
<p><code>lv_obj_t *tile1 = lv_tileview_add_tile( tileview, 0, 0, LV_DIR_RIGHT );</code></p>
<p><code>lv_obj_t *tile2 = lv_tileview_add_tile( tileview, 1, 0, LV_DIR_LEFT );</code></p>
<blockquote>
<p>参数1：平铺视图部件</p>
<p>参数2：列号</p>
<p>参数3：行号</p>
<p>参数4：允许滑动的方向</p>
</blockquote>
<h4 id="设置当前显示页面">设置当前显示页面</h4>
<p><code>lv_obj_update_layout( tileview );</code> /* 更新参数 */</p>
<p><code>lv_obj_set_tile( tileview, tile2, LV_ANIM_OFF ); </code>/* 根据页面对象设置 */</p>
<p><code>lv_obj_set_tile_id( tileview, 1, 0, LV_ANIM_OFF ); </code>    /* 根据页面行列设置 */</p>
<h4 id="页面添加参数">页面添加参数</h4>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230925093204581.png" alt="image-20230925093204581"></p>
<h3 id="font-color-0x00aa00-窗口部件-font"><font color=#0x00aa00>窗口部件</font></h3>
<p>窗口可以作为一个容器，展示不同功能的页面</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131319327.png" alt="image-20230930131319327"></p>
<h4 id="组成-10">组成</h4>
<ul>
<li>头部（Header）</li>
<li>主体（Content）</li>
</ul>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131429425.png" alt="image-20230930131429425"></p>
<h4 id="创建窗口部件">创建窗口部件</h4>
<p><code>lv_obj_t *win = lv_win_create(parent, header_height);</code></p>
<h4 id="添加标题、按钮">添加标题、按钮</h4>
<p><code>lv_obj_t *title = lv_win_add_title(win, &quot;Setting&quot;);</code></p>
<p><code>lv_obj_t *btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE, 20);</code></p>
<h4 id="添加主体内容">添加主体内容</h4>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">lv_obj_t *<span class="attribute">content</span> = <span class="built_in">lv_win_get_content</span>(win); 				<span class="comment">/* 获取主体 */</span></span><br><span class="line">lv_obj_t *<span class="selector-tag">label</span> = <span class="built_in">lv_label_create</span>(<span class="attribute">content</span>);					<span class="comment">/* 添加内容 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-消息框部件-font"><font color=#0x00aa00>消息框部件</font></h3>
<p>消息框部件可以实现弹窗提示，常用于消息通知、确定操作等。</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131517494.png" alt="image-20230930131517494"></p>
<h5 id="组成-11">组成</h5>
<ul>
<li>主体（obj）</li>
<li>标题（title）</li>
<li>关闭按钮（close_btn）</li>
<li>内容（content）</li>
<li>按钮矩阵（btnmatrix）</li>
</ul>
<h4 id="创建消息框部件">创建消息框部件</h4>
<p><code>static const char *btns[] = &#123; &quot;Continue&quot;, &quot;Close&quot;, &quot;&quot; &#125;;</code></p>
<p><code>lv_obj_t *msgbox = lv_msgbox_create( lv_scr_act(), &quot;Notice&quot;, &quot;Do you want to continue?&quot;, btns, true );</code></p>
<p>参数（父对象，标题，主体文字，按钮矩阵，关闭按钮）</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131623830.png" alt="image-20230930131623830"></p>
<h4 id="关闭消息框">关闭消息框</h4>
<p><code>lv_msgbox_close(msgbox);</code></p>
<p>获取按钮索引、文本</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">lv_obj_t</span> *target = lv_event_get_current_target(e);					<span class="comment">/* 获取当前触发源 */</span></span><br><span class="line">lv_msgbox_get_active_btn(target);							<span class="comment">/* 获取按钮索引 */</span></span><br><span class="line">lv_msgbox_get_active_btn_text(target);						<span class="comment">/* 获取按钮文本 */</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="font-color-0x00aa00-微调器部件-font"><font color=#0x00aa00>微调器部件</font></h3>
<p>微调器部件本质上就是一个数字文本，常用于精确调节某个参数的值。</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131725622.png" alt="image-20230930131725622"></p>
<h4 id="组成-12">组成</h4>
<ul>
<li>主体(LV_PART_MAIN）</li>
<li>光标(LV_PART_CURSOR)</li>
</ul>
<h4 id="创建微调器部件">创建微调器部件</h4>
<p><code>lv_obj_t *spinbox = lv_spinbox_create(parent);</code></p>
<h4 id="数值递增、递减">数值递增、递减</h4>
<p><code>lv_spinbox_increment(spinbox); </code>/* 递增 */</p>
<p><code>lv_spinbox_decrement(spinbox); </code>/* 递减 */</p>
<h4 id="设置步进值、范围值">设置步进值、范围值</h4>
<p><code>lv_spinbox_set_step(spinbox, 200); </code>/* 设置步进值，默认为1*/</p>
<p><code>lv_spinbox_set_range(spinbox, -1000, 1000);</code> /* 设置范围值，默认±99999*/</p>
<h4 id="设置当前值">设置当前值</h4>
<p><code>lv_spinbox_set_value(spinbox, 400);</code></p>
<h4 id="设置数字格式、光标位置">设置数字格式、光标位置</h4>
<p><code>lv_spinbox_set_digit_format(spinbox, 4, 2); </code> /* 设置数字位数、小数点位置 */</p>
<p><code>lv_spinbox_set_pos(spinbox, 3);</code> /* 设置光标位置 */</p>
<h4 id="获取当前值-3">获取当前值</h4>
<p><code>lv_spinbox_get_value(spinbox);</code>  /* 返回值为整数，而非小数 */</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131829602.png" alt="image-20230930131829602"></p>
<h3 id="font-color-0x00aa00-表格部件-lv-table-font"><font color=#0x00aa00>表格部件(lv_table)</font></h3>
<p>表格部件由一个个单元格组成，它的单元格中只能存放文本形式的内容。</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131848766.png" alt="image-20230930131848766"></p>
<h4 id="组成-13">组成</h4>
<ul>
<li>主体(LV_PART_MAIN）</li>
<li>单元格(LV_PART_ITEMS)</li>
</ul>
<h4 id="创建表格部件">创建表格部件</h4>
<p><code>lv_obj_t *table = lv_table_create(parent);</code></p>
<h4 id="设置行数、列数">设置行数、列数</h4>
<p><code>lv_table_set_row_cnt(table,2); </code> /* 设置行数 */</p>
<p><code>lv_table_set_col_cnt(table,2);  </code>/* 设置列数 */</p>
<p><code>lv_table_set_col_width(table, 1, 200); </code> /* 设置列的宽度 */</p>
<h4 id="设置单元格的内容">设置单元格的内容</h4>
<p><code>lv_table_set_cell_value(table, 0, 0, &quot;123&quot;); </code></p>
<p><code>lv_table_set_cell_value_fmt(table, 1, 0, &quot;%d&quot;, 100 );</code> /* 格式化输入，类似printf */</p>
<p><img src= "" data-lazy-src="C:%5CUsers%5C12984%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20230930131929760.png" alt="image-20230930131929760"></p>
</article><div class="post-copyright"><div class="post-copyright__title"><span class="post-copyright-info"><h>LVGL</h></span></div><div class="post-copyright__type"><span class="post-copyright-info"><a href="https://certainly.gitee.io/posts/58e5bee2.html">https://certainly.gitee.io/posts/58e5bee2.html</a></span></div><div class="post-copyright-m"><div class="post-copyright-m-info"><div class="post-copyright-a"><h>作者</h><div class="post-copyright-cc-info"><h>Certainly</h></div></div><div class="post-copyright-c"><h>发布于</h><div class="post-copyright-cc-info"><h>2023-09-30</h></div></div><div class="post-copyright-u"><h>更新于</h><div class="post-copyright-cc-info"><h>2023-11-21</h></div></div><div class="post-copyright-c"><h>许可协议</h><div class="post-copyright-cc-info"><a class="icon" rel="noopener" target="_blank" title="Creative Commons" href="https://creativecommons.org/"><i class="fab fa-creative-commons"></i></a><a rel="noopener" target="_blank" title="CC BY-NC-SA 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div></div></div></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E5%AD%A6%E4%B9%A0/"><div class="tags-punctuation"><svg class="faa-tada icon" style="height:1.1em;width:1.1em;fill:currentColor;position:relative;top:2px;margin-right:3px" aria-hidden="true"><use xlink:href="#icon-sekuaibiaoqian"></use></svg></div>学习</a><a class="post-meta__tags" href="/tags/%E7%AC%94%E8%AE%B0/"><div class="tags-punctuation"><svg class="faa-tada icon" style="height:1.1em;width:1.1em;fill:currentColor;position:relative;top:2px;margin-right:3px" aria-hidden="true"><use xlink:href="#icon-sekuaibiaoqian"></use></svg></div>笔记</a></div></div><link rel="stylesheet" href="/css/coin.css" media="defer" onload="this.media='all'"/><div class="post-reward"><button class="tip-button reward-button"><span class="tip-button__text">投喂作者</span><div class="coin-wrapper"><div class="coin"><div class="coin__middle"></div><div class="coin__back"></div><div class="coin__front"></div></div></div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="/null" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="/null" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></button></div><audio id="coinAudio" src="https://npm.elemecdn.com/akilar-candyassets@1.0.36/audio/aowu.m4a"></audio><script defer="defer" src="/js/coin.js"></script><nav class="pagination-post" id="pagination"><div class="next-post pull-full"><a href="/posts/89b46f3b.html"><img class="next-cover" src= "" data-lazy-src="https://s1.vika.cn/space/2022/09/17/56e6e697b218485d9ef9c5bb4f2c57d2" onerror="onerror=null;src='/assets/r2.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">启动文件</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/84a9a809.html" title="嵌入式day01"><img class="cover" src= "" data-lazy-src="https://s1.vika.cn/space/2022/09/17/e40d318236a04b98a7dd84f90f0f1214" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-11-21</div><div class="title">嵌入式day01</div></div></a></div><div><a href="/posts/1da0f9b3.html" title="嵌入式day02"><img class="cover" src= "" data-lazy-src="https://s1.vika.cn/space/2022/09/17/e40d318236a04b98a7dd84f90f0f1214" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-11-21</div><div class="title">嵌入式day02</div></div></a></div><div><a href="/posts/6aa7c925.html" title="嵌入式day03"><img class="cover" src= "" data-lazy-src="https://s1.vika.cn/space/2022/09/17/56e6e697b218485d9ef9c5bb4f2c57d2" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-11-21</div><div class="title">嵌入式day03</div></div></a></div><div><a href="/posts/f4c35c86.html" title="嵌入式day04"><img class="cover" src= "" data-lazy-src="https://source.fomal.cc/img/default_cover_14.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-11-21</div><div class="title">嵌入式day04</div></div></a></div><div><a href="/posts/83c46c10.html" title="嵌入式day05"><img class="cover" src= "" data-lazy-src="https://source.fomal.cc/img/default_cover_14.webp" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-11-21</div><div class="title">嵌入式day05</div></div></a></div><div><a href="/posts/8ce33965.html" title="GPIO"><img class="cover" src= "" data-lazy-src="https://s1.vika.cn/space/2022/09/17/e40d318236a04b98a7dd84f90f0f1214" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-08-18</div><div class="title">GPIO</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><svg class="meta_icon" style="width:22px;height:22px;position:relative;top:5px"><use xlink:href="#icon-mulu1"></use></svg><span style="font-weight:bold">目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-text">LVGL</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%83%A8%E4%BB%B6%E5%88%9B%E5%BB%BA"><span class="toc-text">部件创建</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E9%83%A8%E4%BB%B6"><span class="toc-text">常用部件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%83%A8%E4%BB%B6%E5%B1%9E%E6%80%A7"><span class="toc-text">部件属性</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%A4%A7%E5%B0%8F%E8%AE%BE%E7%BD%AE%E7%9B%B8%E5%85%B3API"><span class="toc-text">大小设置相关API</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BD%8D%E7%BD%AE%E8%AE%BE%E7%BD%AE%E7%9B%B8%E5%85%B3API"><span class="toc-text">位置设置相关API</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AF%B9%E9%BD%90%E8%AE%BE%E7%BD%AE%E7%9B%B8%E5%85%B3API"><span class="toc-text">对齐设置相关API</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%AF%B9%E9%BD%90%E6%A8%A1%E5%BC%8F"><span class="toc-text">对齐模式</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%AF%B9%E9%BD%90%E5%8F%82%E6%95%B0"><span class="toc-text">对齐参数</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%B7%E5%BC%8F%E8%AE%BE%E7%BD%AE"><span class="toc-text">样式设置</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%A4%8D%E9%80%89%E6%A1%86%E9%83%A8%E4%BB%B6-font"><span class="toc-text">复选框部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%A4%8D%E9%80%89%E6%A1%86%E7%BB%84%E6%88%90"><span class="toc-text">复选框组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%A4%8D%E9%80%89%E6%A1%86%E5%88%9B%E5%BB%BA"><span class="toc-text">复选框创建</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%A4%8D%E9%80%89%E6%A1%86%E6%96%87%E6%9C%AC%E8%AE%BE%E7%BD%AE"><span class="toc-text">复选框文本设置</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E8%BF%9B%E5%BA%A6%E6%9D%A1%E9%83%A8%E4%BB%B6-font"><span class="toc-text">进度条部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%BA%A6%E6%9D%A1%E5%88%9B%E5%BB%BA"><span class="toc-text">进度条创建</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%BA%A6%E6%9D%A1%E5%A4%A7%E5%B0%8F%E3%80%81%E5%BD%93%E5%89%8D%E5%80%BC%E5%92%8C%E8%8C%83%E5%9B%B4%E5%80%BC%E8%AE%BE%E7%BD%AE"><span class="toc-text">进度条大小、当前值和范围值设置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%8A%A8%E7%94%BB%E6%97%B6%E9%97%B4"><span class="toc-text">设置动画时间</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%9A%E6%97%B6%E5%99%A8%E5%88%9B%E5%BB%BA"><span class="toc-text">定时器创建</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%BA%A6%E6%9D%A1%E6%95%B0%E5%80%BC%E8%8E%B7%E5%8F%96"><span class="toc-text">进度条数值获取</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%BA%A6%E6%9D%A1GET%E5%AE%8F"><span class="toc-text">进度条GET宏</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%8A%A0%E8%BD%BD%E5%99%A8%E9%83%A8%E4%BB%B6-font"><span class="toc-text">加载器部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8A%A0%E8%BD%BD%E5%99%A8%E7%BB%84%E6%88%90"><span class="toc-text">加载器组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8A%A0%E8%BD%BD%E5%99%A8%E5%88%9B%E5%BB%BA"><span class="toc-text">加载器创建</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%9C%86%E5%BC%A7%E9%A2%9C%E8%89%B2"><span class="toc-text">设置圆弧颜色</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%9C%86%E5%BC%A7%E5%AE%BD%E5%BA%A6"><span class="toc-text">设置圆弧宽度</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-LED%E9%83%A8%E4%BB%B6-font"><span class="toc-text">LED部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#LED%E5%88%9B%E5%BB%BA"><span class="toc-text">LED创建</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#LED%E9%A2%9C%E8%89%B2%E5%8F%8A%E4%BA%AE%E5%BA%A6%E8%AE%BE%E7%BD%AE"><span class="toc-text">LED颜色及亮度设置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#LED%E7%8A%B6%E6%80%81%E8%AE%BE%E7%BD%AE"><span class="toc-text">LED状态设置</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%88%97%E8%A1%A8%E7%BB%84%E4%BB%B6-font"><span class="toc-text">列表组件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E5%88%97%E8%A1%A8%E7%BB%84%E4%BB%B6"><span class="toc-text">创建列表组件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E5%88%97%E8%A1%A8%E6%96%87%E6%9C%AC"><span class="toc-text">添加列表文本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E5%88%97%E8%A1%A8%E6%8C%89%E9%92%AE"><span class="toc-text">添加列表按钮</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%88%97%E8%A1%A8%E6%8C%89%E9%92%AE%E6%96%87%E6%9C%AC"><span class="toc-text">获取列表按钮文本</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E4%B8%8B%E6%8B%89%E5%88%97%E8%A1%A8%E9%83%A8%E4%BB%B6-font"><span class="toc-text">下拉列表部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E4%B8%8B%E6%8B%89%E5%88%97%E8%A1%A8%E7%BB%84%E4%BB%B6"><span class="toc-text">创建下拉列表组件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E9%80%89%E9%A1%B9%E5%86%85%E5%AE%B9"><span class="toc-text">设置选项内容</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E6%89%80%E9%80%89%E9%A1%B9"><span class="toc-text">设置当前所选项</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E9%80%89%E9%A1%B9%E5%86%85%E5%AE%B9"><span class="toc-text">获取选项内容</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%96%B9%E5%90%91%E5%92%8C%E5%9B%BE%E6%A0%87"><span class="toc-text">设置方向和图标</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E6%BB%9A%E8%BD%AE%E9%83%A8%E4%BB%B6-font"><span class="toc-text">滚轮部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-2"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E6%BB%9A%E8%BD%AE%E9%83%A8%E4%BB%B6"><span class="toc-text">创建滚轮部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E9%80%89%E9%A1%B9%E9%97%B4%E9%9A%94"><span class="toc-text">设置选项间隔</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E9%80%89%E9%A1%B9%E5%86%85%E5%AE%B9%E3%80%81%E6%BB%9A%E5%8A%A8%E6%A8%A1%E5%BC%8F"><span class="toc-text">设置选项内容、滚动模式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E6%89%80%E9%80%89%E9%A1%B9-2"><span class="toc-text">设置当前所选项</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%8F%AF%E8%A7%81%E8%A1%8C%E6%95%B0"><span class="toc-text">设置可见行数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E9%80%89%E9%A1%B9%E5%86%85%E5%AE%B9-2"><span class="toc-text">获取选项内容</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E6%BB%91%E5%9D%97%E9%83%A8%E4%BB%B6-font"><span class="toc-text">滑块部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%B7%E5%BC%8F"><span class="toc-text">样式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-3"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E6%BB%91%E5%9D%97%E9%83%A8%E4%BB%B6"><span class="toc-text">创建滑块部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%A4%A7%E5%B0%8F%E3%80%81%E5%BD%93%E5%89%8D%E5%80%BC%E3%80%81%E8%8C%83%E5%9B%B4%E5%80%BC"><span class="toc-text">设置大小、当前值、范围值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%80%BC"><span class="toc-text">获取当前值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A8%A1%E5%BC%8F%E8%AE%BE%E7%BD%AE"><span class="toc-text">模式设置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E3%80%81%E8%8E%B7%E5%8F%96%E5%B7%A6%E5%80%BC"><span class="toc-text">设置、获取左值</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%9C%86%E5%BC%A7%E9%83%A8%E4%BB%B6-font"><span class="toc-text">圆弧部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%B7%E5%BC%8F-2"><span class="toc-text">样式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-4"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E5%9C%86%E5%BC%A7%E9%83%A8%E4%BB%B6"><span class="toc-text">创建圆弧部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E5%80%BC%E3%80%81%E8%8C%83%E5%9B%B4%E5%80%BC"><span class="toc-text">设置当前值、范围值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%9C%86%E5%BC%A7%E8%A7%92%E5%BA%A6"><span class="toc-text">设置圆弧角度</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9C%86%E5%BC%A7%E8%A7%92%E5%BA%A6%E8%AE%BE%E7%BD%AE%E8%8C%83%E5%9B%B4"><span class="toc-text">圆弧角度设置范围</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%97%8B%E8%BD%AC%E8%A7%92%E5%BA%A6"><span class="toc-text">设置旋转角度</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%80%BC-2"><span class="toc-text">获取当前值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%A8%A1%E5%BC%8F%E3%80%81%E5%9C%86%E5%BC%A7%E7%BB%98%E5%88%B6%E9%80%9F%E7%8E%87"><span class="toc-text">设置模式、圆弧绘制速率</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%8E%BB%E9%99%A4%E6%8C%89%E9%92%AE"><span class="toc-text">去除按钮</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E7%BA%BF%E6%9D%A1%E9%83%A8%E4%BB%B6-font"><span class="toc-text">线条部件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%9B%BE%E7%89%87%E9%83%A8%E4%BB%B6-font"><span class="toc-text">图片部件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%89%B2%E7%8E%AF%E9%83%A8%E4%BB%B6"><span class="toc-text">色环部件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E6%8C%89%E9%92%AE%E7%9F%A9%E9%98%B5%E9%83%A8%E4%BB%B6-font"><span class="toc-text">按钮矩阵部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90%E9%83%A8%E5%88%86"><span class="toc-text">组成部分</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E6%8C%89%E9%92%AE%E7%9F%A9%E9%98%B5%E9%83%A8%E4%BB%B6"><span class="toc-text">创建按钮矩阵部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%8C%89%E9%92%AE%E6%95%B0%E9%87%8F%E3%80%81%E6%96%87%E6%9C%AC"><span class="toc-text">设置按钮数量、文本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%8C%89%E9%92%AE%E7%9B%B8%E5%AF%B9%E5%AE%BD%E5%BA%A6"><span class="toc-text">设置按钮相对宽度</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E6%8C%89%E9%92%AE%E7%B4%A2%E5%BC%95%E3%80%81%E6%96%87%E6%9C%AC"><span class="toc-text">获取按钮索引、文本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E3%80%81%E6%B8%85%E9%99%A4%E6%8C%89%E9%92%AE%E5%B1%9E%E6%80%A7"><span class="toc-text">设置、清除按钮属性</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E5%B1%9E%E6%80%A7%E6%9E%9A%E4%B8%BE"><span class="toc-text">属性枚举</span></a></li></ol></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E6%96%87%E6%9C%AC%E5%8C%BA%E5%9F%9F%E9%83%A8%E4%BB%B6-font"><span class="toc-text">文本区域部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-5"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E6%96%87%E6%9C%AC%E5%8C%BA%E5%9F%9F%E9%83%A8%E4%BB%B6"><span class="toc-text">创建文本区域部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E6%96%87%E6%9C%AC"><span class="toc-text">添加文本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%85%89%E6%A0%87%E4%BD%8D%E7%BD%AE"><span class="toc-text">设置光标位置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%A0%E9%99%A4%E6%96%87%E6%9C%AC"><span class="toc-text">删除文本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%A8%A1%E5%BC%8F"><span class="toc-text">设置模式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%99%90%E5%88%B6%E5%AD%97%E7%AC%A6%E8%BE%93%E5%85%A5"><span class="toc-text">限制字符输入</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%8D%A0%E4%BD%8D%E7%AC%A6"><span class="toc-text">设置占位符</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E6%96%87%E6%9C%AC"><span class="toc-text">获取文本</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%AF%94%E5%AF%B9%E6%96%87%E6%9C%AC%E5%86%85%E5%AE%B9"><span class="toc-text">比对文本内容</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%80%9A%E8%BF%87%E9%94%AE%E7%9B%98%E5%9C%A8%E5%A4%9A%E4%B8%AA%E6%96%87%E6%9C%AC%E5%8C%BA%E5%9F%9F%E4%B8%AD%E5%86%99%E5%85%A5%E6%95%B0%E6%8D%AE"><span class="toc-text">通过键盘在多个文本区域中写入数据</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E9%94%AE%E7%9B%98%E9%83%A8%E4%BB%B6-font"><span class="toc-text">键盘部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-6"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E9%94%AE%E7%9B%98%E9%83%A8%E4%BB%B6"><span class="toc-text">创建键盘部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%85%B3%E8%81%94%E6%96%87%E6%9C%AC%E6%A1%86"><span class="toc-text">关联文本框</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%8C%89%E9%94%AE%E5%BC%B9%E7%AA%97"><span class="toc-text">设置按键弹窗</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E9%94%AE%E7%9B%98%E6%A8%A1%E5%BC%8F"><span class="toc-text">设置键盘模式</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E9%94%AE%E7%9B%98%E6%A8%A1%E5%BC%8F"><span class="toc-text">键盘模式</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%87%E6%8D%A2%E6%95%B0%E5%AD%97%E9%94%AE%E7%9B%98%E5%92%8C%E5%B0%8F%E5%86%99%E9%94%AE%E7%9B%98"><span class="toc-text">切换数字键盘和小写键盘</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%9B%BE%E7%89%87%E6%8C%89%E9%92%AE%E9%83%A8%E4%BB%B6-font"><span class="toc-text">图片按钮部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-7"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E5%9B%BE%E7%89%87%E6%8C%89%E9%92%AE%E9%83%A8%E4%BB%B6"><span class="toc-text">创建图片按钮部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%9B%BE%E7%89%87%E6%BA%90%E3%80%81%E6%8C%89%E9%92%AE%E5%A4%A7%E5%B0%8F"><span class="toc-text">设置图片源、按钮大小</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%8C%89%E9%92%AE%E7%8A%B6%E6%80%81"><span class="toc-text">设置按钮状态</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%9B%BE%E7%89%87%E9%80%8F%E6%98%8E%E5%BA%A6%E9%80%9A%E9%81%93"><span class="toc-text">设置图片透明度通道</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E9%80%89%E9%A1%B9%E5%8D%A1%E9%83%A8%E4%BB%B6-font"><span class="toc-text">选项卡部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-8"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E9%80%89%E9%A1%B9%E5%8D%A1%E9%83%A8%E4%BB%B6"><span class="toc-text">创建选项卡部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E9%80%89%E9%A1%B9%E5%8D%A1"><span class="toc-text">添加选项卡</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E9%80%89%E4%B8%AD%E7%9A%84%E9%80%89%E9%A1%B9%E5%8D%A1"><span class="toc-text">设置当前选中的选项卡</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%B9%B3%E9%93%BA%E8%A7%86%E5%9B%BE%E9%83%A8%E4%BB%B6-font"><span class="toc-text">平铺视图部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-9"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E5%B9%B3%E9%93%BA%E8%A7%86%E5%9B%BE%E9%83%A8%E4%BB%B6"><span class="toc-text">创建平铺视图部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E9%A1%B5%E9%9D%A2"><span class="toc-text">添加页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E6%98%BE%E7%A4%BA%E9%A1%B5%E9%9D%A2"><span class="toc-text">设置当前显示页面</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%A1%B5%E9%9D%A2%E6%B7%BB%E5%8A%A0%E5%8F%82%E6%95%B0"><span class="toc-text">页面添加参数</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E7%AA%97%E5%8F%A3%E9%83%A8%E4%BB%B6-font"><span class="toc-text">窗口部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-10"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E7%AA%97%E5%8F%A3%E9%83%A8%E4%BB%B6"><span class="toc-text">创建窗口部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E6%A0%87%E9%A2%98%E3%80%81%E6%8C%89%E9%92%AE"><span class="toc-text">添加标题、按钮</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E4%B8%BB%E4%BD%93%E5%86%85%E5%AE%B9"><span class="toc-text">添加主体内容</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E6%B6%88%E6%81%AF%E6%A1%86%E9%83%A8%E4%BB%B6-font"><span class="toc-text">消息框部件</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E7%BB%84%E6%88%90-11"><span class="toc-text">组成</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E6%B6%88%E6%81%AF%E6%A1%86%E9%83%A8%E4%BB%B6"><span class="toc-text">创建消息框部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%85%B3%E9%97%AD%E6%B6%88%E6%81%AF%E6%A1%86"><span class="toc-text">关闭消息框</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E5%BE%AE%E8%B0%83%E5%99%A8%E9%83%A8%E4%BB%B6-font"><span class="toc-text">微调器部件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-12"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E5%BE%AE%E8%B0%83%E5%99%A8%E9%83%A8%E4%BB%B6"><span class="toc-text">创建微调器部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%95%B0%E5%80%BC%E9%80%92%E5%A2%9E%E3%80%81%E9%80%92%E5%87%8F"><span class="toc-text">数值递增、递减</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%AD%A5%E8%BF%9B%E5%80%BC%E3%80%81%E8%8C%83%E5%9B%B4%E5%80%BC"><span class="toc-text">设置步进值、范围值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%BD%93%E5%89%8D%E5%80%BC"><span class="toc-text">设置当前值</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E6%95%B0%E5%AD%97%E6%A0%BC%E5%BC%8F%E3%80%81%E5%85%89%E6%A0%87%E4%BD%8D%E7%BD%AE"><span class="toc-text">设置数字格式、光标位置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%80%BC-3"><span class="toc-text">获取当前值</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#font-color-0x00aa00-%E8%A1%A8%E6%A0%BC%E9%83%A8%E4%BB%B6-lv-table-font"><span class="toc-text">表格部件(lv_table)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%BB%84%E6%88%90-13"><span class="toc-text">组成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E8%A1%A8%E6%A0%BC%E9%83%A8%E4%BB%B6"><span class="toc-text">创建表格部件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E8%A1%8C%E6%95%B0%E3%80%81%E5%88%97%E6%95%B0"><span class="toc-text">设置行数、列数</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E5%8D%95%E5%85%83%E6%A0%BC%E7%9A%84%E5%86%85%E5%AE%B9"><span class="toc-text">设置单元格的内容</span></a></li></ol></li></ol></li></ol></li></ol></div></div></div></div></main><footer id="footer" style="background-color: transparent;"><div id="footer-wrap"><div id="ft"><div class="ft-item-1"><div class="t-top"><div class="t-t-l"><p class="ft-t t-l-t">格言🧬</p><div class="bg-ad"><div>再看看那个光点，它就在这里，这是家园，这是我们 —— 你所爱的每一个人，你认识的一个人，你听说过的每一个人，曾经有过的每一个人，都在它上面度过他们的一生✨</div><div class="btn-xz-box"><a class="btn-xz" target="_blank" rel="noopener" href="https://stellarium.org/">点击开启星辰之旅</a></div></div></div><div class="t-t-r"><p class="ft-t t-l-t">猜你想看💡</p><ul class="ft-links"><li><a href="/posts/eec9786.html">魔改指南</a><a href="/box/nav/">网址导航</a></li><li><a href="/social/link/">我的朋友</a><a href="/comments/">留点什么</a></li><li><a href="/personal/about/">关于作者</a><a href="/archives/">文章归档</a></li><li><a href="/categories/">文章分类</a><a href="/tags/">文章标签</a></li><li><a href="/box/Gallery/">我的画廊</a><a href="/personal/bb/">我的唠叨</a></li><li><a href="/site/time/">建设进程</a><a href="/site/census/">网站统计</a></li></ul></div></div></div><div class="ft-item-2"><p class="ft-t">推荐友链⌛</p><div class="ft-img-group"><div class="img-group-item"><a target="_blank" rel="noopener" href="https://www.fomal.cc/" title="Fomalhaut🥝"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/60e5d4e39da7c077.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div><div class="img-group-item"><a href="javascript:void(0)" title="广告位招租"><img src= "" data-lazy-src="https://lskypro.acozycotage.net/LightPicture/2022/12/65307a5828af6790.webp" alt=""/></a></div></div></div></div><div class="copyright"><span><b>&copy;2022-2023</b></span><span><b>&nbsp;&nbsp;By Certainly</b></span></div><div id="workboard"></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px" title="博客框架为Hexo_v6.3.0"><img src= "" data-lazy-src="https://sourcebucket.s3.ladydaily.com/badge/Frame-Hexo-blue.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://butterfly.js.org/" style="margin-inline:5px" title="主题版本Butterfly_v4.3.1"><img src= "" data-lazy-src="https://sourcebucket.s3.ladydaily.com/badge/Theme-Butterfly-6513df.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://vercel.com/" style="margin-inline:5px" title="本站采用多线部署，主线路托管于Vercel"><img src= "" data-lazy-src="https://sourcebucket.s3.ladydaily.com/badge/Hosted-Vercel-brightgreen.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://user.51.la/" style="margin-inline:5px" title="本站数据分析得益于51la技术支持"><img src= "" data-lazy-src="https://sourcebucket.s3.ladydaily.com/badge/Analytics-51la-3db1eb.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://icp.gov.moe/?keyword=20226665" style="margin-inline:5px" title="本站已加入萌ICP豪华套餐，萌ICP备20226665号"><img src= "" data-lazy-src="https://sourcebucket.s3.ladydaily.com/badge/萌ICP备-20226665-fe1384.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://bitiful.dogecast.com/buckets" style="margin-inline:5px" title="本网站经Service Worker分流至缤纷云对象存储"><img src= "" data-lazy-src=" https://sourcebucket.s3.ladydaily.com/badge/Bucket-缤纷云-9c62da.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://www.netdun.net/" style="margin-inline:5px" title="本站使用网盾星球提供CDN加速与防护"><img src= "" data-lazy-src="https://sourcebucket.s3.ladydaily.com/badge/CDN-网盾星球-fff2cc.svg" alt=""/></a><a class="github-badge" target="_blank" href="https://github.com/" style="margin-inline:5px" title="本网站源码由Github提供存储仓库"><img src= "" data-lazy-src=" https://sourcebucket.s3.ladydaily.com/badge/Source-Github-d021d6.svg" alt=""/></a></p></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><a class="icon-V hidden" onclick="switchNightMode()" title="浅色和深色模式转换"><svg width="25" height="25" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon"></use></svg></a><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button><button class="share" type="button" title="右键模式" onclick="changeMouseMode()"><i class="fas fa-mouse"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog right_side"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button class="share" type="button" title="分享链接" onclick="share()"><i class="fas fa-share-nodes"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i><span id="percent">0<span>%</span></span></button><button id="go-down" type="button" title="直达底部" onclick="btf.scrollToDest(document.body.scrollHeight, 500)"><i class="fas fa-arrow-down"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div class="js-pjax" id="rightMenu"><div class="rightMenu-group rightMenu-small"><a class="rightMenu-item" href="javascript:window.history.back();"><i class="fa fa-arrow-left"></i></a><a class="rightMenu-item" href="javascript:window.history.forward();"><i class="fa fa-arrow-right"></i></a><a class="rightMenu-item" href="javascript:window.location.reload();"><i class="fa fa-refresh"></i></a><a class="rightMenu-item" href="javascript:rmf.scrollToTop();"><i class="fa fa-arrow-up"></i></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-text"><a class="rightMenu-item" href="javascript:rmf.copySelect();"><i class="fa fa-copy"></i><span>复制</span></a><a class="rightMenu-item" href="javascript:window.open(&quot;https://www.baidu.com/s?wd=&quot;+window.getSelection().toString());window.location.reload();"><i class="fa fa-search"></i><span>百度搜索</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-too"><a class="rightMenu-item" href="javascript:window.open(window.getSelection().toString());window.location.reload();"><i class="fa fa-link"></i><span>转到链接</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-paste"><a class="rightMenu-item" href="javascript:rmf.paste()"><i class="fa fa-copy"></i><span>粘贴</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-post"><a class="rightMenu-item" href="#post-comment"><i class="fas fa-comment"></i><span>空降评论</span></a><a class="rightMenu-item" href="javascript:rmf.copyWordsLink()"><i class="fa fa-link"></i><span>复制本文地址</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-to"><a class="rightMenu-item" href="javascript:rmf.openWithNewTab()"><i class="fa fa-window-restore"></i><span>新窗口打开</span></a><a class="rightMenu-item" id="menu-too" href="javascript:rmf.open()"><i class="fa fa-link"></i><span>转到链接</span></a><a class="rightMenu-item" href="javascript:rmf.copyLink()"><i class="fa fa-copy"></i><span>复制链接</span></a></div><div class="rightMenu-group rightMenu-line hide" id="menu-img"><a class="rightMenu-item" href="javascript:rmf.saveAs()"><i class="fa fa-download"></i><span>保存图片</span></a><a class="rightMenu-item" href="javascript:rmf.openWithNewTab()"><i class="fa fa-window-restore"></i><span>在新窗口打开</span></a><a class="rightMenu-item" href="javascript:rmf.copyLink()"><i class="fa fa-copy"></i><span>复制图片链接</span></a></div><div class="rightMenu-group rightMenu-line"><a class="rightMenu-item" href="javascript:randomPost()"><i class="fa fa-paper-plane"></i><span>随便逛逛</span></a><a class="rightMenu-item" href="javascript:switchNightMode();"><i class="fa fa-moon"></i><span>昼夜切换</span></a><a class="rightMenu-item" href="/personal/about/"><i class="fa fa-info-circle"></i><span>关于博客</span></a><a class="rightMenu-item" href="javascript:toggleWinbox();"><i class="fas fa-cog"></i><span>美化设置</span></a><a class="rightMenu-item" href="javascript:rmf.fullScreen();"><i class="fas fa-expand"></i><span>切换全屏</span></a><a class="rightMenu-item" href="javascript:window.print();"><i class="fa-solid fa-print"></i><span>打印页面</span></a></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.umd.min.js"></script><script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/instant.page/5.1.0/instantpage.min.js" type="module"></script><script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vanilla-lazyload/17.3.1/lazyload.iife.min.js"></script><script src="/js/search/local-search.js"></script><script async="async">var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())
setTimeout(function(){preloader.endLoading();}, 5000);
document.getElementById('loading-box').addEventListener('click',()=> {preloader.endLoading()})</script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    chtml: {
      scale: 1.2
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        insertScript: [200, () => {
          document.querySelectorAll('mjx-container:not\([display]\)').forEach(node => {
            const target = node.parentNode
            if (target.nodeName.toLowerCase() === 'li') {
              target.parentNode.classList.add('has-jax')
            } else {
              target.classList.add('has-jax')
            }
          });
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><script>(()=>{
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: '',
      region: '',
      onCommentLoaded: function () {
        btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
      }
    }, null))
  }

  const getCount = () => {
    const countELement = document.getElementById('twikoo-count')
    if(!countELement) return
    twikoo.getCommentsCount({
      envId: '',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      countELement.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const runFn = () => {
    init()
    
  }

  const loadTwikoo = () => {
    if (typeof twikoo === 'object') {
      setTimeout(runFn,0)
      return
    } 
    getScript('https://cdn.staticfile.org/twikoo/1.6.8/twikoo.all.min.js').then(runFn)
  }

  if ('Twikoo' === 'Twikoo' || !true) {
    if (true) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo()
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script src="https://cdn.staticfile.org/jquery/3.6.3/jquery.min.js"></script><script async src="https://cdn1.tianli0.top/npm/vue@2.6.14/dist/vue.min.js"></script><script async src="https://cdn1.tianli0.top/npm/element-ui@2.15.6/lib/index.js"></script><script async src="https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.11/clipboard.min.js"></script><script defer type="text/javascript" src="https://cdn1.tianli0.top/npm/sweetalert2@8.19.0/dist/sweetalert2.all.js"></script><script async src="//npm.elemecdn.com/pace-js@1.2.4/pace.min.js"></script><script defer src="https://cdn1.tianli0.top/gh/nextapps-de/winbox/dist/winbox.bundle.min.js"></script><script async src="//at.alicdn.com/t/c/font_3586335_hsivh70x0fm.js"></script><script async src="//at.alicdn.com/t/c/font_3636804_gr02jmjr3y9.js"></script><script async src="//at.alicdn.com/t/c/font_3612150_kfv55xn3u2g.js"></script><script async src="https://cdn.wpon.cn/2022-sucai/Gold-ingot.js"></script><canvas id="universe"></canvas><canvas id="snow"></canvas><script defer src="/js/fomal.js"></script><link rel="stylesheet" href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/aplayer/1.10.1/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/aplayer/1.10.1/APlayer.min.js"></script><script src="https://cdn1.tianli0.top/npm/js-heo@1.0.12/metingjs/Meting.min.js"></script><script src="https://lib.baomitu.com/pjax/0.2.8/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show","#web_bg",".js-pjax","#bibi","body > title","#app","#tag-echarts","#posts-echart","#categories-echarts"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --> <script data-pjax>if(document.getElementById('recent-posts') && (location.pathname ==='/'|| '/' ==='all')){
    var parent = document.getElementById('recent-posts');
    var child = '<div class="recent-post-item" style="width:100%;height: auto"><div id="catalog_magnet"><div class="magnet_item"><a class="magnet_link" href="https://certainly.gitee.io/categories/演示/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">🍥 演示笔记 (1)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item"><a class="magnet_link" href="https://certainly.gitee.io/categories/嵌入式/"><div class="magnet_link_context" style=""><span style="font-weight:500;flex:1">💻 嵌入式笔记 (14)</span><span style="padding:0px 4px;border-radius: 8px;"><i class="fas fa-arrow-circle-right"></i></span></div></a></div><div class="magnet_item" style="visibility: hidden"></div><a class="magnet_link_more"  href="https://certainly.gitee.io/categories/" style="flex:1;text-align: center;margin-bottom: 10px;">查看更多...</a></div></div>';
    console.log('已挂载magnet')
    parent.insertAdjacentHTML("afterbegin",child)}
     </script><style>#catalog_magnet{flex-wrap: wrap;display: flex;width:100%;justify-content:space-between;padding: 10px 10px 0 10px;align-content: flex-start;}.magnet_item{flex-basis: calc(33.333333333333336% - 5px);background: #e9e9e9;margin-bottom: 10px;border-radius: 8px;transition: all 0.2s ease-in-out;}.magnet_item:hover{background: var(--text-bg-hover)}.magnet_link_more{color:#555}.magnet_link{color:black}.magnet_link:hover{color:white}@media screen and (max-width: 600px) {.magnet_item {flex-basis: 100%;}}.magnet_link_context{display:flex;padding: 10px;font-size:16px;transition: all 0.2s ease-in-out;}.magnet_link_context:hover{padding: 10px 20px;}</style>
    <style></style><script data-pjax>
  function butterfly_swiper_injector_config(){
    var parent_div_git = document.getElementById('recent-posts');
    var item_html = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/2013454d.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://source.fomal.cc/img/default_cover_14.webp" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-08-09</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/2013454d.html&quot;);" href="javascript:void(0);" alt="">Markdown语法与外挂标签写法汇总</a><div class="blog-slider__text">🥧本文汇总Markdown格式以及外挂标签在网页端的渲染效果，可作为文档进行查询</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/2013454d.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/3dd6bae0.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://s1.vika.cn/space/2022/09/17/e40d318236a04b98a7dd84f90f0f1214" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-03-19</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/3dd6bae0.html&quot;);" href="javascript:void(0);" alt="">Hexo学习-1</a><div class="blog-slider__text">Hexo学习笔记1，Hexo文章编辑。</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/3dd6bae0.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
    console.log('已挂载butterfly_swiper')
    parent_div_git.insertAdjacentHTML("afterbegin",item_html)
    }
  var elist = 'undefined'.split(',');
  var cpage = location.pathname;
  var epage = '/';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_swiper_injector_config();
  }
  else if (epage === cpage){
    butterfly_swiper_injector_config();
  }
  </script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '2s');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '30');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '2s');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '30');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script></div><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow_init.js"></script><script data-pjax src="https://npm.elemecdn.com/hexo-filter-gitcalendar/lib/gitcalendar.js"></script><script data-pjax>
  function gitcalendar_injector_config(){
      var parent_div_git = document.getElementById('gitZone');
      var item_html = '<div class="recent-post-item" id="gitcalendarBar" style="width:100%;height:auto;padding:10px;"><style>#git_container{min-height: 320px}@media screen and (max-width:650px) {#git_container{min-height: 0px}}</style><div id="git_loading" style="width:10%;height:100%;margin:0 auto;display: block;"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animatetransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animatetransform></path></svg><style>#git_container{display: none;}</style></div><div id="git_container"></div></div>';
      parent_div_git.insertAdjacentHTML("afterbegin",item_html)
      console.log('已挂载gitcalendar')
      }

    if( document.getElementById('gitZone') && (location.pathname ==='/site/census/'|| '/site/census/' ==='all')){
        gitcalendar_injector_config()
        GitCalendarInit("/api?null",['#d9e0df', '#c6e0dc', '#a8dcd4', '#9adcd2', '#89ded1', '#77e0d0', '#5fdecb', '#47dcc6', '#39dcc3', '#1fdabe', '#00dab9'],'null')
    }
  </script><!-- hexo injector body_end end --></body></html>